﻿using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Compose
{
    public class CommandLine
    {
        [MetadataAttribute]
        [AttributeUsage(AttributeTargets.Class)]
        public class CommandAttribute : ExportAttribute
        {
            public CommandAttribute() : base(typeof(CmdLine))
            {
            }
            //此处的CommandName与ICommandMedaData接口中的CommandName名称必须一致
            public string CommandName { get; set; }
        }
    }

        /// <summary>
        /// 命令行参数
        /// </summary>
        public interface ICommand:IDisposable
        {
            /// <summary>
            /// 执行方法
            /// </summary>
            /// <param name="input"></param>
            /// <returns></returns>
            string  Execute(string  input);

        ///// <summary>
        ///// <para>通信方法</para>
        ///// <para>Reg方法中注册收到数据处理方法</para>
        ///// </summary>
        ///// <param name="msg"></param>
        //void ReceiveMsg(NotificationMessageAction<string> msg);

        string  ReceiveMsg(string msg);

        /// <summary>
        /// <para>通信方法</para>
        /// <para>回调方法，执行完send后的数据回复</para>
        /// </summary>
        /// <param name="msg"></param>
        void CallBack(string msg);

        /// <summary>
        /// <para>初始化通信组件</para>
        /// </summary>
        /// <param name="messenger">通信组件</param>
        void MessengerInit(IMessenger messenger);

      }

        public interface ICommandMedaData
        {
            string CommandName { get; }
        }

    
}
